# -*- coding: utf-8 -*-

from sys import stdout

class Log (object):
	def __init__(self, filename = None, loglvl = 1):
		if filename == None:
			self.__fd = stdout
		else:
			self.__fd = open (filename, 'w')
		self.__loglvl = loglvl
	
	def debug1(self, format, *others):
		if self.__loglvl < 1 : return
		self.__fd.write((format + '\n') % others)
	
	def debug2(self, format, *others):
		if self.__loglvl < 2 : return
		self.__fd.write((format + '\n') % others)
	
	def debug3(self, format, *others):
		if self.__loglvl < 3 : return
		self.__fd.write((format + '\n') % others)
	
	def close(self):
		self.__fd.close()

